﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SisEagle.Common.Code;
using System.Text;


namespace SisEagle.common.UserControl
{
    public partial class ucBotoesMestre : System.Web.UI.UserControl
    {

        #region Controls
        private Button btnNovo;
        private Button btnSalvar;
        private Button btnSalvarFechar;
        private Button btnExcluir;
        private Button btnCancelar;

        #endregion
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        /// <summary>
        /// Seta o estado do objeto
        /// </summary>
        /// <param name="Acao"></param>
        public void SetAcao(ActionData Acao)
        {
            btnExcluir.Enabled = (Acao != ActionData.New);
        }


        #region Botoes

        public Button BotaoNovo
        {
            get
            {
                return btnNovo;
            }
        }
        public Button BotaoSalvar
        {
            get
            {
                return btnSalvar;
            }
        }
        public Button BotaoSalvarFechar
        {
            get
            {
                return btnSalvarFechar;
            }
        }
        public Button BotaoExcluir
        {
            get
            {
                return btnExcluir;
            }
        }
        public Button BotaoCancelar
        {
            get
            {
                return btnCancelar;
            }
        }

        #endregion

        /// <summary>
        /// Verdadeiro quando alguma das mensagens adicionadas contem erros
        /// </summary>
        public bool HasError { get; internal set; }

        #region Finds

        protected void Inicializer()
        {
            btnNovo = FindControl("btnNovo") as Button;
            btnSalvar = FindControl("btnSalvar") as Button;
            btnSalvarFechar = FindControl("btnSalvarFechar") as Button;
            btnExcluir = FindControl("btnExcluir") as Button;
            btnCancelar = FindControl("btnCancelar") as Button;
        }
        #endregion
    }
}
